class PairsController < ApplicationController
	def index
		@pairs = Pair.all
	end
	def show
		@pair = Pair.find params[:id]
	end
	def edit
		@pair = Pair.find params[:id]
	end
	def update
		@pair = Pair.find params[:id]
		if @pair.update_attributes(params[:pair])
			if @pair.score > 0			
				@pair.opponent.update_attribute(:score, 0)
			end
			flash[:notice] = "successfully updated score"
		end
		redirect_to players_path
	end
end
